import axios from '@/libs/api.request'

export const getTableData = (teamId, currentPage, pageSize) => {
  return axios.request({
    url: '/resource/api/' + teamId + '/' + currentPage + '/' + pageSize,
    method: 'get'
  })
}

export const getRoleData = (currentPage, pageSize) => {
  return axios.request({
    url: '/role/' + currentPage + '/' + pageSize,
    method: 'get'
  })
}

export const getRole2API = (roleId, currentPage, pageSize) => {
  return axios.request({
    url: '/role/api/' + roleId + '/' + currentPage + '/' + pageSize,
    method: 'get'
  })
}

export const getRole2User = (roleId, currentPage, pageSize) => {
  return axios.request({
    url: '/role/user/' + roleId + '/' + currentPage + '/' + pageSize,
    method: 'get'
  })
}

export const getRole2Menu = (roleId, currentPage, pageSize) => {
  return axios.request({
    url: '/role/menu/' + roleId + '/' + currentPage + '/' + pageSize,
    method: 'get'
  })
}

export const getUser = (currentPage, pageSize) => {
  return axios.request({
    url: '/user/list/' + '/' + currentPage + '/' + pageSize,
    method: 'get'
  })
}

export const getUser2Role = (appId) => {
  return axios.request({
    url: '/user/role/' + appId,
    method: 'get'
  })
}

export const getAccountLog = (currentPage, pageSize) => {
  return axios.request({
    url: '/log/accountLog/' + currentPage + '/' + pageSize,
    method: 'get'
  })
}

export const getOperationLog = (currentPage, pageSize) => {
  return axios.request({
    url: '/log/operationLog/' + currentPage + '/' + pageSize,
    method: 'get'
  })
}

export const getDragList = () => {
  return axios.request({
    url: 'get_drag_list',
    method: 'get'
  })
}

export const errorReq = () => {
  return axios.request({
    url: 'error_url',
    method: 'post'
  })
}

export const saveErrorLogger = info => {
  return axios.request({
    url: 'save_error_logger',
    data: info,
    method: 'post'
  })
}

export const uploadImg = formData => {
  return axios.request({
    url: 'image/upload',
    data: formData
  })
}

export const getOrgData = () => {
  return axios.request({
    url: '/resource/menus',
    method: 'get'
  })
}

export const getTreeSelectData = () => {
  return axios.request({
    url: 'get_tree_select_data',
    method: 'get'
  })
}
